<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>在线商城后台管理</title>
<link rel="stylesheet" type="text/css" href="views/admin/style/css/basic.css" />
<link rel="stylesheet" type="text/css" href="views/admin/style/css/manager.css" />
<link rel="stylesheet" type="text/css" href="views/admin/style/css/pagination.css" />
<link rel="stylesheet" type="text/css" href="views/admin/style/css/nav.css" />
<script type="text/javascript" src="views/common/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="views/common/js/artDialog4.1.6/jquery.artDialog.js?skin=idialog"></script>
<script type="text/javascript" src="views/common/js/artDialog4.1.6/plugins/iframeTools.js"></script>
<script type="text/javascript" src="views/common/js/jquery-validation/jquery.validate.js"></script>
</head>
<body>
<script type="text/javascript">
    $(document).ready(function() {
        $(".del").click(function() {
            var id = $(this).parents("tr").find("td:eq(0)").text();
            art.dialog.confirm('你确定要删除这个导航吗？', function () {
                $.get("?c=nav&m=del&id=" + id,
                    function(msg){
                        if(msg == 'success'){
                            art.dialog.tips('删除成功！', 1.5);
                            setTimeout(function(){
                                art.dialog.top.document.location.reload();
                            },1500);
                        } else {
                            art.dialog.tips('删除失败！', 1.5);
                        }
                    }
                );
            });
        })
    $(".update").click(function() {
        var id = $(this).parents("tr").find("td:eq(0)").text();
        art.dialog.open('?c=nav&m=update&id=' + id,{
            id:"iframe_update",
            title:'修改导航',
            width:'480px',
            height:'200px'
        }).lock();
    });
    $("#add_nav").click(function() {
        art.dialog.open('?c=nav&m=add',{
            id:"iframe_add",
            title:'添加导航',
            width:'480px',
            height:'240px'
        }).lock();
    });
    //导航排序
    $("#update_form").validate({
        submitHandler:function(){
        var content = $("#update_form").serialize();
        $.ajax({
            type:"POST",
            async:true,
            url:'?c=nav&m=sort',
            data:content,
            success:function(msg){
                if(msg == 'success'){
                    art.dialog.tips('排序成功！', 1.5);
                    setTimeout(function(){
                        art.dialog.top.document.location.reload();
                    },1500);
                } else {
                    art.dialog.tips('排序失败，请稍后重试！', 1.5);
                }
            }
        });
    },
    });
})
</script>
<!--
<script type="text/javascript">
$(document).ready(function() {
    $(".add").click(function() {
        var id = $(this).parents("tr").find("td:first-child span").text();
        art.dialog.open('?c=nav&m=addsub&id=' + id,{
            id:"iframe_addsub",
            title:'添加子导航',
            width:'480px',
            height:'220px'
        }).lock();
    });
})
</script>
-->
<h2><a id="add_nav" href="javascript:void(0)">添加导航</a>商品 -- 导航条列表</h2>
<div id="list">
    <form id="update_form">
	<table>
        <thead>
		<tr>
            <th>编号</th>
            <th>导航名称</th>
            <th>导航简介</th>
            <th>导航子类</th>
            <th>排序</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <{foreach from=$allNav key=key item=value}>
		<tr>
            <td><{$value->id}></td>
            <td><{$value->nav_name}></td>
            <td><{$value->nav_info}></td>
            <td>
                <a href="?c=nav&pid=<{$value->id}>" class="view">查看</a>
                <!--&nbsp;&nbsp;|&nbsp;
                <a href="javascript:void(0)" class="add">增加</a>-->
            </td>
            <td><input type="text" name="sort[<{$value->id}>]" class="sort" value="<{$value->sort}>"></td>
            <td><a href="javascript:void(0)" class="update"><img src="views/admin/style/images/edit.gif" alt="编辑" title="编辑" /></a>
            <a href="javascript:void(0)" class="del"><img src="views/admin/style/images/drop.gif" alt="删除" title="删除" /></a>
            </td>
        </tr>
        <{foreachelse}>
            <tr><td colspan="6">暂无数据！</td></tr>
        <{/foreach}>  
        </tbody>
        <tfoot>
            <tr>
                <td colspan="3"></td>
                <td><{if $oneNav}>主类名称：[<{$oneNav[0]->nav_name}>]<{/if}></td>
                <td>
                    <{if $allNav}>
                    <div><button type="submit" class="button" name="update">排序</button></div>
                    <{/if}>
                </td>
                <td></td>
            </tr>
        </tfoot>
	</table>
    </form>
</div>
<div class="pagination pagination-right">
<{$pagination}>
</div>
</body>
</html>